home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 June / Ahoy_Magazine_87-06_1987_Double_L.d64 / Max Square (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  615b  |  21 lines

  1. 0 rem << cd42-10 >>
  2. 1 rem ==================================
  3. 2 rem    commodares problem #38-4 :
  4. 3 print"[147]maximum square "
  5. 4 rem    solution by
  6. 5 rem    jim speers
  7. 6 rem ==================================
  8. 100 fora=1to7:forb=a+1to8:forc=b+1to9
  9. 110 ia(a)=1:ia(b)=1:ia(c)=1
  10. 120 n=1:fori=1to9:ifia(i)=1then140
  11. 130 ib(n)=i:n=n+1
  12. 140 nexti
  13. 150 ford=1to4:fore=d+1to5:forf=e+1to6
  14. 160 n=1:k=1:fori=1to6:if(d=iore=iorf=i)thenx(n)=ib(i):n=n+1:goto200
  15. 170 y(k)=ib(i):k=k+1
  16. 200 nexti:r=a*b*c:s=x(1)*x(2)*x(3):t=y(1)*y(2)*y(3):q=r+s+t
  17. 210 ifq>mthenm=q:printa;b;c;"="r:fori=1to3:printx(i);:next:print"=";s:fori=1to3:printy(i);:next:print"=";t:print"total=";m:print""
  18. 220 nextf,e,d
  19. 230 fori=1to9:ia(i)=0:nexti
  20. 240 nextc,b,a
  21.